<?php
$dom=new DOMDocument('1.0', 'utf-8'); //DOMDocument Object
$filename="./index.xml";
$bool=@$dom->load($filename);

if($bool===true){
	foreach ($dom->getElementsByTagName('*') as $node) {
		echo $node->getNodePath() . "<br>";
	}
	$node=$dom->getElementsByTagName("姓名");
	foreach ($node as $v){
		echo $v->childNodes->item(0)->wholeText ."<br>"; //DOMElement Object		
	}	
	//echo $dom->getElementsByTagName('户籍地')->item(3)->nodeValue;	
	$address=$dom->getElementsByTagName('户籍地');	
	
	foreach ($address as $key=>$value){
		echo $value->nodeValue."<br>";
	}
}else {
	echo '文件不存在';
}
function p($arr){
	echo "<pre>";
	print_r($arr);
	echo "</pre>";
}